<?php
	/**
	 * 救济金详情
	 */
    class  AlmsDetail extends APIBase {
		
		public $tag = "AlmsDetail";
		public $isLogin = true;
		
		public function before() {
			$this->initCacheRedis();
			$this->initMysql();
			return true;
		}

		public function logic() {
			$uid = $this->uid;
			$alms = $this->param['money'];
			$list = $this->data_redis->hMGet("hu:".$uid,array('money','benefit_cnt'));
			$total = (int)$list['money']+(int)$alms;
			$benefit_cnt = (int)$list['benefit_cnt'];
			if($benefit_cnt < Game::$broke_num_max){
				$benefit_cnt = $benefit_cnt+1;
			}
			$this->data_redis->hMSet("hu:".$uid,array('money'=>$total,'benefit_cnt'=>$benefit_cnt));
			$this->returnData($benefit_cnt);
		}
		
    	public function after() {
			$this->deinitCacheRedis();
		}
    }
?>
